<?php

require_once 'SpecHelper.php';

class DescribeMutableFile extends PHPSpec_Context
{

    public function itShouldAcceptNameOfFileToGenerateMutationsFor() 
    {
        $mutable = new PHPMutagen_MutableFile(realpath('./_files2/src/Math.php'));
        $this->spec($mutable->getFilename())
             ->should->be(realpath('./_files2/src/Math.php'));
    }

    public function itShouldGenerateMutationsIndexedByTokenizerIndex() 
    {
        $mutable = new PHPMutagen_MutableFile(realpath('./_files2/src/Math.php'));
        $mutable->generateMutations();
        $mutations = $mutable->getMutations();
        $this->spec($mutations[26])->should->beAnInstanceOf('PHPMutagen_Mutation');
    }

    /** Mutation Types **/

    public function itShouldGenerateAnOperatoradditionMutationIfPossible() 
    {
        $mutable = new PHPMutagen_MutableFile(realpath('./_files2/src/Math.php'));
        $mutable->generateMutations();
        $mutations = $mutable->getMutations();
        $this->spec($mutable->hasMutation('OperatorAddition'))->should->beTrue();
    }

}
